<?php
	/***********************************
        * Sistema de Administracion Hotelera
        * Archivo:      registroEntrada.php
        * Proposito:   	Se le pide al operador entrar datos para la seleccion de la habitacion
        * Creado por:   Pablo Gonzalez
        * Creado:       14/05/2008
        ************************************/
		
	require '../common/secure.php';
	
	validateSessionAlive();
	validateAccess(array("1", "2"), $_SESSION['UserRol']);
	
	require '../common/header.php';
	
	$dateToday = new DateTime(); 
	//echo $date->format('d/m/Y');
?>
<html>
	<head>
		<title>.: Hotel Real Santa Fe :.</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">	
		<link rel=stylesheet type="text/css" href="../estilo.css">
		<script language="javascript" src="../common/generalScript.js"></script>
		<!--CSS file (default YUI Sam Skin) -->
		<link rel="stylesheet" type="text/css" href="../common/yui/build/calendar/assets/skins/sam/calendar.css">
		<!-- Dependencies -->
		<script type="text/javascript" src="../common/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
		<!-- Source file -->
		<script type="text/javascript" src="../common/yui/build/calendar/calendar-min.js"></script>
		<style>
			#calSalidaContainer { display:none; position:absolute; left:580px; top:240px; margin-left: 5px; z-index:1}
		</style>
	</head>
	<body>
		<?php displayHeader(); ?>
		
		<div id="leftnav" align="right" valign="top">
			<table border="0" cellspacing="2" cellpadding="2" width="100%">
				<tr>
					<td onclick="goto('registroEntradaSalida.php');">Atr&aacute;s</td>
				</tr>
			</table>
		</div>
		
		<div id="contents" align="center" valign="middle">
			<table border="0" cellpadding="2" cellspacing="2" width="600px">
				<tr>
					<td>
						<h3>Registro de Entrada</h3>
					</td>
				</tr>
				<tr>
					<td>
						<table border="0" cellpadding="2" cellspacing="2" width="100%">
							<tr>
								<td width="15px">&nbsp;</td>
								<td>
									<div style="font-weight: bold;">Seleccionar Fechas de Hospedaje</div>
									<br />
									<div>
										<form action="select_room.php" method="post">
											<table class="table_form" width="75%" align="center">
												<tr>
													<td class="form_tag">Fecha Entrada:</td>
													<td>
														<?php echo $dateToday->format('d/m/Y'); ?>
													</td>
												</tr>
												<tr>
													<td class="form_tag">Fecha Salida:</td>
													<td class="yui-skin-sam" valign="middle">
	                                                    <div style="position: relative; width: 200px; left: 0px;">
		                                                    <input type="text" value="" name="txtFechaSalida" id="txtFechaSalida" disabled="true"/>
															
		                                                    <img id="imgShowCalendar2" src="../imagenes/calendar.gif" />
		                                                    <input type="hidden" id="hidFechaSalida" name="hidFechaSalida" />
	                                                    </div>
	                                                    <div id="calSalidaContainer"></div>
                                                    </td>
												</tr>
												<tr>
													<td colspan="2" align="center">
														<div class="error"><?php echo $error ?></div>
													</td>
												</tr>
												<tr>
													<td>&nbsp;</td>
													<td align="right">
														<input type="submit" value="Enviar" name="cmdSubmit" id="cmdSubmit" />
													</td>
												</tr>
											</table>
										</form>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>
	</body>
</html>
<script language="javascript">
	var selectHandler2 = function(type, args, bj) {
		var selected = args[0];
        var selDate = this.toDate(selected[0]);
        var txtFechaSalida = document.getElementById('txtFechaSalida');
		var hidFechaSalida = document.getElementById('hidFechaSalida');
		
		var day = selDate.getDate() < 10 ? '0' + selDate.getDate() : selDate.getDate();
		var month = (selDate.getMonth() + 1) < 10 ? '0' + (selDate.getMonth() + 1) : (selDate.getMonth() + 1);
        var strDate = day + '/' + month + '/' + selDate.getFullYear();
               
        txtFechaSalida.value = strDate;
        hidFechaSalida.value = strDate;
		               
		this.hide();
	}
	   
	//calendario Salida
    // A DIV with id "cal1Container" should already exist on the page
    var calSalida = new YAHOO.widget.Calendar("calSalida", "calSalidaContainer", { title:"Escoga una fecha:", close:true });
      
    calSalida.cfg.setProperty("navigator", true);
       
    calSalida.cfg.setProperty("MONTHS_SHORT",   ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"]);
    calSalida.cfg.setProperty("MONTHS_LONG",    ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]);
    calSalida.cfg.setProperty("WEEKDAYS_1CHAR", ["D", "L", "M", "M", "J", "V", "S"]);
    calSalida.cfg.setProperty("WEEKDAYS_SHORT", ["D", "L", "M", "Mi", "J", "V", "S"]);
    calSalida.cfg.setProperty("WEEKDAYS_MEDIUM",["Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"]);
    calSalida.cfg.setProperty("WEEKDAYS_LONG",  ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"]);
       
    YAHOO.util.Event.addListener("imgShowCalendar2", "click", calSalida.show, calSalida, true);
     
    calSalida.selectEvent.subscribe(selectHandler2, calSalida, true);//deselectHandler
       
    calSalida.render();
</script>